<?php 
namespace backend\controllers;
use Yii;
use backend\controllers\CommontController;
use yii\db\query;

class AreaController extends CommontController
{	
    public function actionAdd($p_id=0)
    {   
        if (Yii::$app->request->isPost) {
            print_r(Yii::$app->request->isPost);exit;
        }else{
        $query = new Query();
        $data = $query->from('job_area')->where(['parent_id'=>$p_id])->All();
        return $this->render('add',["info"=>$data]);            
        }
    }
    public function actionAjax()
    {
       if (Yii::$app->request->isAjax) 
       {    
            $id = Yii::$app->request->get('id');
            $query = new Query();
            $data = $query->from('job_area')->where(['parent_id'=>$id])->All();
            if ($data) 
            {   
                $msg['error'] = 1;
                $msg['msg']="成功";
                $msg['content']=$data;
            }else{
                $msg['error'] = 0;
                $msg['msg']="失败";                
            }
            echo json_encode($msg);
       }
    }






}


 ?>